package com.itzsj.service.implement;

import com.itzsj.mapper.EnterpriseMapper;
import com.itzsj.pojo.dto.ERespondDTO;
import com.itzsj.pojo.dto.EResumesDTO;
import com.itzsj.pojo.entity.Message;
import com.itzsj.pojo.vo.EResumesVO;
import com.itzsj.service.EnterpriseService;
import com.itzsj.pojo.entity.Enterprise;
import com.itzsj.pojo.entity.Job;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;

@Service
public class EnterpriseServiceImpl implements EnterpriseService {

    @Resource
    private EnterpriseMapper enterpriseMapper;

    @Override
    public List<Job> select(String eno) {
        return enterpriseMapper.select(eno);
    }

    @Override
    public List<EResumesVO> selectResume(EResumesDTO puttedResumeDTO) {
        return enterpriseMapper.selectResume(puttedResumeDTO);
    }

    @Override
    public void announce(Job job) {
        job.setAnnounceTime(LocalDateTime.now());
        enterpriseMapper.announce(job);
    }

    @Override
    public Enterprise get(String eno) {
        return enterpriseMapper.get(eno);
    }

    @Override
    public void stopAnnounce(String id) {
        enterpriseMapper.stopAnnounce(id);
        enterpriseMapper.stopAnnounceP(id);
    }

    @Override
    public List<Message> listMessages(String eno, Integer jobId) {
        return enterpriseMapper.listMessages(eno, jobId);
    }

    @Override
    public void respond(ERespondDTO respond) {
        enterpriseMapper.respond(respond.getId(), respond.getRespond(), LocalDateTime.now());
    }
}
